package com.dunqi.gpm.cangxi.WeekReport.WeekChek.WeekCheckDetail;

import android.annotation.SuppressLint;

import com.dunqi.gpm.cangxi.common.api.ApiFactory;
import com.dunqi.gpm.cangxi.common.api.RxSchedulers;
import com.dunqi.gpm.cangxi.common.base.Data;
import com.dunqi.gpm.cangxi.common.util.CommonUtil;

public class CheckModel {
    interface DataResult {

        void fail(Throwable throwable);

        void success(Data data);
    }

    /**
     * @param weeklyReportId 周报告Id
     * @param projectId      项目id
     * @param auditRemark    审批备注
     * @param auditStatus    结果（2：同意，3：不同退回）
     * @return
     */
    @SuppressLint("CheckResult")
    public void Auditsave(DataResult dataResult, String weeklyReportId, String projectId, String auditRemark, String auditStatus) {
        ApiFactory.getInstance()
                .projectWeeklyAuditSave(CommonUtil.getDeviceId(), weeklyReportId, projectId, auditRemark, auditStatus)
                .compose(RxSchedulers.io_main())
                .subscribe(data -> {
                    dataResult.success(data);
                }, throwable -> {
                    dataResult.fail(throwable);
                });
    }
}
